
<div class="container">
    <div class="wyc_top">
        <if condition="session(user_auth) eq null">
            <div class="denglu">
                <a href="" target="_self" data-toggle="modal" data-target="#myModal10"><img src="__PUBLIC__/Home/public/img/denglu.png" />登录</a>
                <a>丨</a>
                <a href="" target="_self" data-toggle="modal" data-target="#myModal11">注册</a>
            </div>
        <else />
            <div class="denglu">
                <span>您好 ! </span>
                <span> {:session('user_auth.username')}</span>&nbsp;&nbsp;&nbsp;
                <a href="{:U('Task/index')}" target="_blank"> 个人中心 </a>&nbsp;&nbsp;&nbsp;
                <a href="{:U('User/logout')}" onclick="return confirm('是否确认退出登录？')">退出</a>
            </div>
        </if>
        <!--transparent-->
        <ul>
            <li ><a href="{:U('Desk/index')}" target="_self" >首&nbsp;页</a></li>
            <li><a href="{:U('Desk/taskinfo')}" target="_self">{$templete_arr[0]['name']}</a></li>
            <li><a href="{:U('Desk/taskguide')}" target="_self">{$templete_arr[1]['name']}</a></li>
            <li><a href="{:U('Task/add')}" target="_self">查新委托</a></li>
            <li><a href="{:U('Desk/service')}" target="_self">{$templete_arr[2]['name']}</a></li>
            <li><a href="{:U('Desk/money')}" target="_self">{$templete_arr[3]['name']} </a></li>
            <li><a href="{:U('Desk/userknow')}" target="_self">{$templete_arr[4]['name']}</a></li>
            <li><a href="{:U('Desk/help')}" target="_self">{$templete_arr[5]['name']}</a></li>
        </ul>
    </div>
</div>

<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal10" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="left: 5%;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    <img src="__PUBLIC__/Home/public/img/close.png"/>
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    登录我的账号
                </h4>
            </div>
            <form method="post" action=""  >
                <div class="clear"></div>
                <div class="modal-body" style="padding: 0;">
                    <span class="denglu2"><img src="__PUBLIC__/Home/public/img/user.png"/><input class="" type="text" placeholder="请输入用户名" style="padding-left: 10px;" name="username" /></span>
                    <div class="clear"></div>
                    <span class="denglu2"><img src="__PUBLIC__/Home/public/img/password.png"/><input class="" type="password" placeholder="请输入密码" style="padding-left: 10px;" name="password"/></span>
                    <a href="" target="_self"  data-toggle="modal" data-target="#myModal11" style="color: #909090;font-size: 12px;margin-left: 300px;;margin-top: 10px;display: block;" id="close">立即注册>></a>
                </div>
                <div class="modal-footer" style="height: 50px;padding: 0;">
                    <!--<button type="button" class="btn btn-default"-->
                    <!--data-dismiss="modal">取消-->
                    <!--</button>-->
                    <button type="button" class="btn btn-primary" onclick="user_login()" id="sub_button4" >
                        登录
                    </button>
                </div>
            </form>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
<script type="text/javascript">
    $(function(){
        $("#close").click(function(){
            $("#myModal10").hide();
        })
    })
</script>
<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal11" tabindex="-1" role="dialog" aria-labelledby="myModalLabel2" aria-hidden="true" >
    <div class="modal-dialog" style="left: 5%;">
        <div class="modal-content" style="width: 415px;">
            <div class="modal-header">
                <button type="button" class="close" id="closee"
                        data-dismiss="modal" aria-hidden="true">
                    <img src="__PUBLIC__/Home/public/img/close.png"/>
                </button>
                <h4 class="modal-title" id="myModalLabel2">
                    注册我的账号
                </h4>
            </div>
            <form action="{:U('Public/register')}" method="post" class="form_home1" >
                <div class="modal-body">

                    <span class="denglu3"><img src="__PUBLIC__/Home/public/img/users.png"/><input class="reg_username" type="text" placeholder="请输入用户名" style="padding-left: 10px;"name="username"/></span>
                    <div class="clear"></div>
                    <span class="denglu3"><img src="__PUBLIC__/Home/public/img/phone.png"/><input class="reg_tel" type="text" placeholder="请输入手机号" style="padding-left: 10px;"name="tel" /></span>
                    <div class="clear"></div>
                    <span class="denglu3"><img src="__PUBLIC__/Home/public/img/mail.png"/><input class="reg_email" type="text" placeholder="请输入邮箱" style="padding-left: 10px;" name="email" /></span>
                    <div class="clear"></div>
                    <span class="denglu3"><img src="__PUBLIC__/Home/public/img/password.png"/><input class="reg_password" type="password" placeholder="请输入密码" style="padding-left: 10px;"name="password"/></span>
                    <div class="clear"></div>
                    <span class="denglu3"><img src="__PUBLIC__/Home/public/img/password.png"/><input class="reg_repassword" type="password" placeholder="请确认密码" style="padding-left: 10px;"name="repassword"/></span>

                </div>
                <div class="modal-footer" style="margin-bottom: 20px;">
                    <!--<button type="button" class="btn btn-default"-->
                    <!--data-dismiss="modal">关闭-->
                    <!--</button>-->
                    <button type="submit" class="btn btn-primary ajax-post" target-form="form_home1"  >
                        注册
                    </button>
                </div>
            </form>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
<script>
    $(function() {
        toastr.options = {
            "closeButton": false,
            "debug": true,
            "progressBar": true,
            "positionClass": "toast-top-center",
            "showDuration": "400",
            "hideDuration": "1000",
            "timeOut": "7000",
            "extendedTimeOut": "1000",
            "showEasing": "swing",
            "hideEasing": "linear",
            "showMethod": "fadeIn",
            "hideMethod": "fadeOut"
        }
        // validate signup form on keyup and submit
        $("#closee").click(function(){
            $(".modal-backdrop").hide();
        })
        $("#close").click(function(){
            $("#myModal10").hide();
        })

    });


    $('#myModal10').bind('keydown', function (e) {
        var key = e.which;
        if (key == 13) {
            user_login()
        }
    });
    //个人登录
    function user_login(){
        $('#sub_button4').prop('disabled',true);
        var arr = {};
        arr['username']      = $('input[name="username"]').val();
        arr['password']      = $('input[name="password"]').val();
        $.post("{:U('Public/login')}", {login:arr}, function(r){
            if(r.result == 1){
                toastr.success('执行信息','登录成功');
                setTimeout(function(){
                    location.reload();
                },1500);
            }else{
                $('#sub_button4').prop('disabled',false);
                toastr.error(r.msg,'登录失败');
            }
        });
    }

</script>